<?php defined( '_JEXEC' ) or die( 'Restricted access' ); ?><?php defined( '_SEXEC' ) or die( 'Restricted access' ); ?>
<?php
	if(!isset($_SESSION['username']) && !isset($_SESSION['usertype']))
		header("location: index.php");
?>
<?php

	$backup_filename = substr($_SERVER['DOCUMENT_ROOT'], 0, 2) . "/db_backup_".date("d-m-Yhis").".sql";
	
	// shell command for taking the database backup
	$list = shell_exec("backup\mysqldump " . DB_NAME . " > " . $backup_filename . " --host=" . DB_HOST . " --user=" . DB_USER . " --password=" . DB_PASSWORD);
	
	echo "<br /><br /><br /><br />";
	echo "<center><b>Backup is taken successfully at " . $backup_filename . "</b></center>";
	echo "<br /><br /><br /><br />";

?>